package com.itheima.mapper;

import com.github.pagehelper.Page;
import com.itheima.pojo.CheckGroup;
import com.itheima.pojo.CheckItem;
import com.itheima.pojo.Member;
import com.itheima.pojo.Setmeal;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

public interface MemberMapper {
    Member findByTelephone(String telephone);

    void add(Member member);

    Integer findMemberCountBeforeDate(String month);

    Integer findMemberCountAfterDate(String afterMonth);

    Integer findMemberCountByDate(String today);

    Integer findMemberTotalCount();

    Page<Member> findPage(String queryString);

    Member findById(Integer id);

    void edit(Member member);

    void addMember(Member member);

    void updateMemberDetail(Member member);
//
    List<Map> findByTelAndOrderDate(Map map);

    void deleteMember(Integer id);

    List<Map<String,Object>> findAgeByBirthday();

    void deleteById(Integer id);

    List<Setmeal> findSetmealByMember(Integer id);

    List<CheckGroup> findCheckGroupById(Integer id);

    List<Map> findOrderByTel(String telephone);

    Member findByTelAndPassword(Map map);


    List<CheckItem> findCheckItemByCheckGroupId(Integer id);

    Member findByName(String name);

    /*@Insert("insert into t_member(name,phoneNumber,regTime) value (#{name},#{phoneNumber},#{regTime})")*/
    void addByCondition(@Param("name") String name, @Param("phoneNumber") String phoneNumber, @Param("regTime") String date);

    @Update("update t_member set name=#{name} where id={memberId}")
    void editByName(@Param("name") String name,@Param("id") Integer memberId);
}
